#ifndef REGISTREDIALOG_H
#define REGISTREDIALOG_H

#include <QDialog>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetworkProxy>
#include <QMessageBox>
namespace Ui {
    class RegistreDialog;
}

class RegistreDialog : public QDialog
{
    Q_OBJECT

public:
    explicit RegistreDialog(QWidget *parent = 0);
    ~RegistreDialog();

private:
    Ui::RegistreDialog *ui;

private slots:
    void on_pushButton_3_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_clicked();
    void OnFinished(QNetworkReply *reply);
private:
    QNetworkAccessManager *network_manager;
    QNetworkRequest req;
    QByteArray data;
    QByteArray request;
    enum REGISTRATION_STATE
    {
        GET_PARAMETRS_LIST,
        GET_IMAGE,
        SEND_POST_QUERY

    };
    REGISTRATION_STATE CurrentState;
    QUrl GetParametrsList;
    QUrl CaptchaUrl;
    QUrl RegisterUrl;
    QUrl CurrentCaptchaUrl;
    QNetworkProxy proxy;
    struct REGISTER_INFO
    {
        QString challenge;
        QString CaptchaText;
        QString UserName;
        QString UserPassword;
    };
    REGISTER_INFO RegInfo;
    QMessageBox MessageBox;
    QImage image;
public:
      void ConstructGetChallengeQuery();
      void ConstructGetCaptchaQuery();
      void OnLoad();

};

#endif // REGISTREDIALOG_H
